<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>试题详情页</title>
    <script type="text/javascript"  src="http://code.jquery.com/jquery-1.8.3.js"></script>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
  <script type="text/javascript"  src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  <link rel="stylesheet" href="index.css">
  <link rel="stylesheet" href="main.css">
  <link rel="stylesheet" href="item.css">
  <script type="text/javascript" src="./static/store.legacy.min.js"></script>
  <script src="./static/util.js"></script>
</head>
<body>
  <header>
    <div class="headerSwipper">
      <div class="headerSwipper_div">
        <div class="headerSwipper_div_iconview">
          <img src="./static/images/logo.png" alt="">
        </div>
        <div class="headerSwipper_div_myicon">
          <!-- <img src="" alt=""> -->
          <span class="loginText">登录</span>
          <div class="headerSwipper_div_myicon_icon" style="display: none">
            <img src="./static/images/iconsmall.png" alt="">
          </div>
          <div class="headerSwipper_div_myicon_info">
            <ul>
              <li class="headerSwipper_div_myicon_info_li">消息</li>
              <li class="headerSwipper_div_myicon_info_li">退出</li>
            </ul>
          </div>
        </div>
        <ul class="headerSwipper_div_ul">
          <li class="headerSwipper_div_li mobileapp">手机APP</li>
          <li class="headerSwipper_div_li vipprop">开通VIP</li>
        </ul>
      </div>
    </div>
  </header>
  <section>
    <div class="ImgSwipperview">
      <img class="ImgSwipperview_img" src="./static/images/mainSwipper.png" alt="">
    </div>
  </section>
  <section>
    <div class="mainContentView">
      <div class="contentView">
        <!-- 上侧导航 -->
        <div class="topnav">
          <ul class="contentView_ul">
            <li class="contentView_li contentView_li_active">首页</li>
            <li class="contentView_li">学习中心</li>
            <li class="contentView_li">志愿填报</li>
            <li class="contentView_li">微课</li>
            <li class="contentView_li">模拟试题</li>
            <li class="contentView_li">往届真题</li>
            <li class="contentView_li">咨询</li>
          </ul>
          <div class="inputview">
            <input class="inputview_input" id="tag" 
 type="text" placeholder="搜索院校">
            <img  class="searchicon_img" src="./static/images/searchicon.png" alt="">
          </div>
        </div>
      </div>
    </div>
  </section>
  <section>
    <div class="itemViewSiwpper">
      <div class="itemView">
        <div class="articleView">
          <p class="articleView_title"></p>
          <p class="articleView_vicetitle"><span>发布日期：</span><span class="create_time"></span><span class="hasleftdistance">阅读：</span><span class="read_num"></span></p>
          <p class="articleView_mainBody"></p>
        </div>
        <div class="functionView">
          <span class="front_article article_btn">上一篇</span>
          <span class="back_article article_btn">下一篇</span>
          <div class="collect_article">
            <img class="collect_img" src="" alt="">
            <span>收藏</span>
          </div>
          <div class="collect_article_file">
            <span>下载</span>
          </div>
        </div>
      </div>
    </div>
  </section>
  <footer>
    <div class="footerSwipper">
      <div class="footerSwipper_div">
        <ul class="footerSwipper_div_ul">
          <span class="footerSwipper_div_ul_span"><a href="./index.html">首页</a></span>
          <li class="footerSwipper_div_ul_li"><a href="./schools.html?keyword=">院校大全</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./major.html">专业大全</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./mentality.html">心理辅导</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./careerPlanning.html">职业规划</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./infoTest.html">高考资讯</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./recruitment.html?type=1">自主招生</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./recruitment.html?type=2">单独招生</a></li>
        </ul>
        <ul class="footerSwipper_div_ul">
          <span class="footerSwipper_div_ul_span">学习提升</span>
          <li class="footerSwipper_div_ul_li"><a href="./index.html?index=3">微课</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./index.html?index=4">模拟试题</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./index.html?index=5">往届试题</a></li>
        </ul>
        <ul class="footerSwipper_div_ul">
          <span class="footerSwipper_div_ul_span">志愿填报</span>
          <li class="footerSwipper_div_ul_li"><a href="./index.html?index=6">咨询</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./mobileapp.html">下载APP</a></li>
        </ul>
        <!-- 扫一扫关注我们区域 -->
        <div class="QRcodeSwipper">
          <span class="QRcodeSwipper_span">扫一扫关注我们</span>
          <div class="QRcodeSwipper_imgview">
            <img src="./static/images/qr.png" alt="">
          </div>
        </div>
        <!-- 中间信息区域 -->
        <div class="middleInfo">
          <span class="middleInfo_span_city">中国·河南·郑州</span>
          <span class="middleInfo_span_GE"><span class="middleInfo_span_GE_icon middleInfo_span_GE_icon_special phone_icon"><img src="./static/images/phone.png" alt=""></span><span class="middleInfo_span_GE_text middleInfo_span_GE_text_color">0371-68064945</span></span>
          <span class="middleInfo_span_GE"><span class="middleInfo_span_GE_icon message_icon"><img src="./static/images/message.png" alt=""></span><span class="middleInfo_span_GE_text">595879735@qq.com</span></span>
          <span class="middleInfo_span_GE"><span class="middleInfo_span_GE_icon message_icon"><img src="./static/images/store.png" alt=""></span><span class="middleInfo_span_GE_text">河南柒佰伴教育信息咨询有限公司
          </span></span>
          <span class="middleInfo_span_GE"><span class="middleInfo_span_GE_icon middleInfo_span_GE_icon_special address_icon"><img src="./static/images/address.png" alt=""></span><span class="middleInfo_span_GE_text middleInfo_span_GE_text_special">郑州市郑东新区立体世界
            </span></span>
        </div>
        <p class="footerSwipper_div_p">河南世霖网络软件科技 2014-2018 豫ICP备14010456号-1</p>
      </div>
    </div>
  </footer>
  <script src="./static/util.js"></script>
  <script>
    $(document).ready(function(){
      var downloadurl = ''
      ArrowNavigation($('.itemView'), ['main','testItem'])
      // 初始化方法
      // 登录隐藏
      $('.headerSwipper_div_myicon_info').hide()
      var imglist = ['./static/images/collect_green.png','./static/images/collect_green_active.png']
      var id = getparse(location.href, 0)
      var type = getparse(location.href, 1)
      function init () {
        console.log(id)
        var initdata = ''
        $.ajax({
            url: urlhost + '/admin.php/api/homepage/st_detail',
            type: 'POST',
            data: {st_id: id, uid: store.get('uid')},
            header: {},
            success: function (res) {
              if (res.code == 0) {
                loadingHide()
                initdata = res
                $('.articleView').find('.articleView_title').text(initdata.data.stu_title)
                $('.articleView').find('.create_time').text(initdata.data.add_time)
                $('.articleView').find('.read_num').text(initdata.data.status)
                $('.articleView').append(initdata.data.stu_content)
                $('.collect_img').attr('src', imglist[Number(res.data.status)])
                $('.collect_img').addClass('img'+ res.data.status)
                $('.front_article').attr('id', initdata.data.front.id)
                $('.back_article').attr('id', initdata.data.after.id)
                downloadurl = initdata.data.stu_file
              } else {
                // 移除加载中样式
                loadingHide()
                return(res.data)
              }
            },
            fail: function () {
              alert('网络有问题')
            }
          })
        // 加载ajax来的数据 从url上获取类型 以及id 
      }
      init()
      // 监听上下篇事件
      $('body').on('click', '.article_btn', function () {
        if(!$(this).attr('id')) {
          widowAle('没有更多了')
          return
        }
        location.href = './testItem.html?id=' + $(this).attr('id') + '&type=' + type
      })
      // li标签点击 需要跳转页面 同时传递第几个 进行初始化
      $('.contentView_li').click(
        function() {
          var index = $(this).index()
          window.location.href = './index.html?index=' + index
        }
      )
      // 收藏点击
      $('.itemViewSiwpper').on('click', '.collect_article', function () {
        if($(this).find('img').hasClass('img0')) {
          $(this).find('img').removeClass('img0')
          $(this).find('img').addClass('img1')
          $(this).find('img').attr('src', imglist[1])
          $.ajax({
            url: urlhost + '/admin.php/api/homepage/test_sc',
            method: 'POST',
            data: {
              uid: store.get('uid'),
              flag: 1,
              test_id: id,
              type: type
            },
            success: function(res) {
              // 收藏成功
              widowAle(res.msg)
            }
          })
        }else {
          $(this).find('img').addClass('img0')
          $(this).find('img').removeClass('img1')
          $(this).find('img').attr('src', imglist[0])
          $.ajax({
            url: urlhost + '/admin.php/api/homepage/test_sc',
            method: 'POST',
            data: {
              uid: store.get('uid'),
              flag: 1,
              test_id: id,
              type: type
            },
            success: function(res) {
              widowAle(res.msg)
            }
          })
        }
      })

      // 点击下载
      // 收藏点击
      $('.itemViewSiwpper').on('click', '.collect_article_file', function () {
        console.log(downloadurl)
        window.open(downloadurl)
      })
  })
  </script>
  </body>
</html>
